package com.hualan.servlet;

import com.alibaba.fastjson.JSON;
import com.hualan.bean.PanghuCourierStation;
import com.hualan.dao.StageDao1;

import com.hualan.dao.StageDao1;
import com.hualan.dao.StageDaoImpl1;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

@WebServlet("/courierStation/modifyCourierStation")
public class ModifyServlet extends HttpServlet {
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        int id = Integer.parseInt(req.getParameter("courierStationId"));
        int  status = Integer.parseInt(req.getParameter("courierStationStatus"));
        StageDao1 stageDao1 = new StageDaoImpl1();
        int row = stageDao1.modify(id,status);
        Map<String, Object> map = new HashMap<>();
        if (row > 0){map.put("code", 200);
        }else {
        map.put("code", 300);
        }
        resp.getWriter().write(JSON.toJSONString(map));
    }
}
